#! /usr/bin/env python
# -*- coding: utf-8 -*-

warn_type = '指标异常'
warn_type_key = 'index_abnormal'
warn_level = '黄色预警'
warn_level_key = 3
company_name = '福建优力特材料有限公司'
company_id = '1820379858379681793'
warn_number = '2025'
warn_name = '液氨'
warn_status = '已消警'
warn_status_key = 'extinguished_warn'
deal_status = '处置中'
deal_status_key = 'under_disposal'
start_time = '2025-04-10 00:00:00'
end_time = '2025-04-11 00:00:00'

query_sql = '''
SELECT
	count(*) 
FROM
	hgyq_major_hazard_sources.mw_m_warn_info 
WHERE
	is_deleted = 0 
	AND warn_type = "''' + warn_type_key + '''" 
	AND warn_level = ''' + str(warn_level_key) + '''
	AND create_dept = "''' + company_id + '''" 
	AND warn_no LIKE "%''' + warn_number + '''%" 
	AND warn_name LIKE "%''' + warn_name + '''%" 
	AND warn_status = "''' + warn_status_key + '''" 
	AND disposal_status = "''' + deal_status_key + '''" 
	AND warn_time BETWEEN "''' + start_time + '''" 
	AND "''' + end_time + '''"
'''

reset_sql = '''
SELECT
	count(*) 
FROM
	hgyq_major_hazard_sources.mw_m_warn_info 
WHERE
	is_deleted = 0 
	AND create_dept = "''' + company_id + '''" 
	AND NOT ( warn_status != "extinguished_warn" AND disposal_status != "disposed" ) 
	AND warn_type != "risk_assessment"
'''
